<?php
require_once("tasktypeView.php");
require_once(CORE_DIR.'tasktypeModel.php');

class deleteAction extends authAction{

	function __construct(){
		$this->view = new tasktypeView();
	}

	public function run($get, $post, $viewtype) {
		parent::run($get,$post,$viewtype);
		
		$ttModel = new tasktypeModel();		
		
		if (isset($get["id"]) ){
			$id = $get["id"];
			
			$affectedRows = $ttModel->deleteTaskType($id);
			$status = ($affectedRows != -1)? 1: 0;

			$this->view->setProperty("status", $status);
			$this->view->setProperty("id", $id);
			$this->view->showDeleteTaskType();
		}
		else{
			$this->view->showBadCmd();
		}	
			
	}
}
?>